unit uTestBeaRLibMG;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ComCtrls;

type
  TfTestBeaRLibMG = class(TForm)
    RE: TRichEdit;
    procedure FormCreate(Sender: TObject);
    procedure FormKeyUp(Sender: TObject; var Key: Word;
      Shift: TShiftState);
  private
    { Private declarations }
  public
    { Public declarations }
    procedure A;
  end;

type TBeaRLibMap = array of Char;
procedure GenMap(X, Y, ID: Integer; var A: TBeaRLibMap; S: Integer); stdcall; external 'BeaRLibMG.dll';

var
  fTestBeaRLibMG: TfTestBeaRLibMG;
  DR: TBeaRLibMap;
  X: Word = 99; // 50 .. 511
  Y: Word = 99; // 50 .. 511

implementation

{$R *.dfm}

procedure TfTestBeaRLibMG.A;
var
  I, J, Z: Integer;
  S: string;
begin
  RE.Clear;
  Z := 17;
//  for Z := 1 to 16 do
  begin
    RE.Lines.Append('#' + IntToStr(Z));
    SetLength(DR, X*Y);
    GenMap(X, Y, Z, DR, X*Y);
    for I := 0 to X - 1 do
    begin
      S := '';
      for J := 0 to Y - 1 do
        S := S + DR[I * Y +J];
      RE.Lines.Append(S);
    end;
  end;
end;

procedure TfTestBeaRLibMG.FormCreate(Sender: TObject);
begin
  A;
end;

procedure TfTestBeaRLibMG.FormKeyUp(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  A;
end;

end.
